var t = require("../../../wxParse/wxParse.js"), a = getApp();

Page({
    data: {
        submit_status: !1,
        status: !1
    },
    onLoad: function(t) {
        this.getData();
    },
    toRecord: function() {
        wx.navigateTo({
            url: "/packageE/video_question/videoRecord/videoRecord"
        });
    },
    tap_agreement: function() {
        this.setData({
            is_agreement: !0
        });
    },
    close_agreement: function() {
        this.setData({
            is_agreement: !1
        });
    },
    tapSubmit_status: function() {
        this.setData({
            submit_status: !1
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    goHome: function() {
        wx.navigateTo({
            url: "/packageE/video_question/video_question"
        });
    },
    user: function(t) {
        var a = t.detail.value;
        this.setData({
            username: a
        });
    },
    mobile: function(t) {
        var a = t.detail.value;
        this.setData({
            mobile: a
        });
    },
    tapAgeSta: function() {
        this.setData({
            status: !this.data.status
        });
    },
    submit: function() {
        if (this.data.status) {
            var t = this, e = a.getNetAddresss("plugin.agent-qa.api.application.apply-agent");
            a._postNetWork({
                url: e,
                data: {
                    username: t.data.username,
                    mobile: t.data.mobile
                },
                success: function(a) {
                    var e = a.data;
                    1 == e.result ? (t.setData({
                        submit_status: !0
                    }), t.getData()) : e.msg && (e.msg.mobile ? wx.showToast({
                        title: e.msg.mobile[0],
                        icon: "none",
                        duration: 1e3
                    }) : e.msg.username ? wx.showToast({
                        title: e.msg.username[0],
                        icon: "none",
                        duration: 1e3
                    }) : wx.showToast({
                        title: e.msg,
                        icon: "none",
                        duration: 1e3
                    }));
                },
                fail: function(t) {
                    wx.showToast({
                        title: t.msg,
                        icon: "none"
                    });
                }
            });
        } else wx.showToast({
            title: "请阅读服务协议并同意",
            icon: "none",
            duration: 1e3
        });
    },
    getData: function() {
        var e = this, n = this, s = a.getNetAddresss("plugin.agent-qa.api.index.index");
        a._postNetWork({
            url: s,
            success: function(a) {
                var s = a.data;
                if (1 == s.result) {
                    n.setData({
                        info: s.data,
                        agreement: s.data.agreement,
                        application_audit_status: s.data.application_audit_status
                    });
                    var i = e.data.agreement;
                    try {
                        i.indexOf("&#") <= -1 && t.wxParse("article", "html", i, e);
                    } catch (t) {}
                }
            },
            fail: function(t) {
                wx.showToast({
                    title: t.msg,
                    icon: "none"
                });
            }
        });
    }
});